<template lang="pug">
	view.u-page
		u-list
			u-list-item(v-for="(item, index) in starList" :key="index")
				u-cell(:title="`${item.name}  ￥${item.price}`" @click="gotoDetails(item)")
					u-avatar(slot="icon"
						shape="square"
						size="35"
						:src="item.imgurl"
						customStyle="margin: -3px 5px -3px 0")
	
</template>

<script>
	export default{
		data(){
			return{
				Rimgurl:'http://47.102.203.158:2001/commodity/',
				starList:[]
			}
		},
		methods:{
			getStarLsit(){
				
			},
			gotoDetails(obj){
				uni.navigateTo({
					url:'/pages/commodity/commodity?cid='+obj.cid
				})
			},
		},
		onLoad() {
			
		},
		onShow() {
			uni.$u.http.get('/stars').then(res=>{
				console.log(res.data);
				this.starList = res.data.data
				for (let i = 0; i < this.starList.length; i++) {
					let zz = this.starList[i].imgurl 
					 this.starList[i].imgurl =this.Rimgurl+zz
				}
			})
		}
	}
	
</script>

<style scoped>
	.search{
		margin: 30rpx 30rpx;
	}
</style>